import { BaseEntity } from '@libs/common/entities';
import { ApiProperty } from '@nestjs/swagger';
import { Column, Entity, JoinColumn } from 'typeorm';

import { Member } from '@/dingding/member/entities/member.entity';

@Entity('crm_node_hr_overtime')
export class Overtime extends BaseEntity {
  @ApiProperty({ description: '钉钉ID' })
  @Column({ comment: '钉钉ID', unique: true })
  dingId: string;

  @ApiProperty({ description: '用户ID' })
  @Column({ comment: '用户ID', unique: true })
  userId: string;

  @ApiProperty({ description: '用户' })
  @JoinColumn({ name: 'user' })
  user: Member;

  @ApiProperty({ description: '用户名' })
  @Column({ comment: '用户名' })
  userName: string;

  @ApiProperty({ description: '已用时长/单位分钟' })
  @Column({ type: 'double', comment: '已用时长/单位分钟', default: 0 })
  usedTime: number;

  @ApiProperty({ description: '剩余时长/单位分钟' })
  @Column({ type: 'double', comment: '剩余时长/单位分钟', default: 0 })
  remainTime: number;

  @ApiProperty({ description: '总计时长/单位分钟' })
  @Column({ type: 'double', comment: '总计时长/单位分钟', default: 0 })
  totalTime: number;
}
